package com.wjh.common;

/**
 * 分布式锁常量类
 * 
 * @author wenjianhai
 * @date 2023/6/27
 * @since JDK 17
 */
public class LockConstant {
    /** 商品下单:锁名称 */
    public static final String SAVE_ORDER_LOCK_NAME = "save_order_lock_%s";
    /** 商品下单锁:最多等待时间 */
    public static final long SAVE_ORDER_LOCK_WAIT_TIME = 2;
    /** 商品下单锁:上锁后自动释放锁时间 */
    public static final long SAVE_ORDER_LOCK_LEASE_TIME = 2;

    /** 订单支付:锁名称 */
    public static final String PAY_ORDER_LOCK_NAME = "pay_order_lock_%s_%s";
    /** 订单支付:最多等待时间 */
    public static final long PAY_ORDER_LOCK_WAIT_TIME = 3;
    /** 订单支付:上锁后自动释放锁时间 */
    public static final long PAY_ORDER_LOCK_LEASE_TIME = 3;

    /** 更新订单的支付状态:锁名称 */
    public static final String UPDATE_ORDER_PAY_STATE_LOCK_NAME = "update_order_pay_state_lock_%s";
    /** 更新订单的支付状态:最多等待时间 */
    public static final long UPDATE_ORDER_PAY_STATE_LOCK_WAIT_TIME = 3;
    /** 更新订单的支付状态:上锁后自动释放锁时间 */
    public static final long UPDATE_ORDER_PAY_STATE_LOCK_LEASE_TIME = 3;

    /** 更新用户可用金额:锁名称 */
    public static final String UPDATE_USER_AMOUNT_LOCK_NAME = "update_user_amount_lock_%s";
    /** 更新用户可用金额:最多等待时间 */
    public static final long UPDATE_USER_AMOUNT_LOCK_WAIT_TIME = 3;
    /** 更新用户可用金额:上锁后自动释放锁时间 */
    public static final long UPDATE_USER_AMOUNT_LOCK_LEASE_TIME = 3;

    /** 订单支付成功处理:锁名称 */
    public static final String HANDLE_PAY_SUCCESS_LOCK_NAME = "handle_pay_success_lock_%s";
    /** 订单支付成功处理:最多等待时间 */
    public static final long HANDLE_PAY_SUCCESS_LOCK_WAIT_TIME = 2;
    /** 订单支付成功处理:上锁后自动释放锁时间 */
    public static final long HANDLE_PAY_SUCCESS_LOCK_LEASE_TIME = 2;
}
